package com.darwin.uuas.userdetailservice;

import com.darwin.uuas.authvo.AuthUser;
import com.darwin.uuas.authvo.Role;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class UserDetailService implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        AuthUser authUser = new AuthUser();
        authUser.setUsername("Darwin");
        authUser.setPassword("123456");
        //
        List<Role> roles = new ArrayList<>();
        Role role = new Role();
        role.setName("admin");
        roles.add(role);
        authUser.setRoles(roles);
        return authUser;
    }
}
